﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// 动画一帧包含的帧信息
/// </summary>
public class FrameInfo
{
    /// <summary>
    /// 帧序号
    /// </summary>
    public int FrameIndex = 0;
    /// <summary>
    /// 帧父节点
    /// </summary>
   // private AnimClipInfo Pa】rentClip= null;
    /// <summary>
    /// 一帧在动画的比率 (float * 1000 减少浮点运算误差)
    /// </summary>
    private float FrameRatio = 0;
    /// <summary>
    /// 帧所在的动画时间点
    /// </summary>
    public float FrameTime = 0;
    /// <summary>
    /// normalizedTime
    /// </summary>
    public float normalizedTime = 0;
    /// <summary>
    /// 改帧的中断序列信息
    /// </summary>
    public Data.ActionInterrupt interrupt=null;
    /// <summary>
    /// 该帧的触发事件
    /// </summary>
    public Data.Event mEvent = null;
    /// <summary>
    /// 改帧的攻击定义
    /// </summary>
    public Data.AttackDef attackDef = null;
    /// <summary>
    /// 动画名
    /// </summary>
    public string animName = string.Empty;
    /// <summary>
    /// 百分比
    /// </summary>
    public int NormalizedPercent = 0;
    /// <param name="frameIndex">帧序列</param>
    /// <param name="frameRatio">帧时间</param>
    /// <param name="frameTime">帧在的动画时间轴</param>
    public FrameInfo(string animName, int frameIndex,float frameRatio,float frameTime,float normalizedTime)
    {
        this.NormalizedPercent = Mathf.Clamp((int)(normalizedTime * 100), 0, 100);
        this.normalizedTime = normalizedTime;
        this.animName = animName;
        this.FrameIndex = frameIndex;
        this.FrameRatio = frameRatio;
        this.FrameTime = frameTime;
    }
}
